<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html;charset=utf-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新华每日新闻</title>
    <link rel="stylesheet" href="<c:url value="/resources/css/index.css"/>"/>
</head>
<body>
<!-- 头部区域 -->
<header class="news-header">
    <div class="header-top">
        <div class="date-time">2025年10月8日 星期三 16:17</div>
        <div class="weather">北京 晴 18°C</div>
    </div>

    <div class="logo-area">
        <h1 class="site-name">新华每日新闻</h1>
        <div class="header-right">
            <div class="search-bar">
                <input type="text" placeholder="搜索新闻...">
                <button>搜索</button>
            </div>
            <c:if test="${empty sessionScope.user}">
                <button class="login-btn"><a href="<c:url value="/page/login"/>">登录</a></button>
            </c:if>
            <c:if test="${!empty sessionScope.user}">
                <span class="welcome">欢迎，${sessionScope.user}</span>
                <button class="login-btn"><a href="" onclick="logout()">退出</a></button>
            </c:if>
        </div>
    </div>

    <nav class="main-nav">
        <ul>
            <li class="active"><a href="<c:url value="/page/homepage"/>">首页</a></li>
            <li><a href="<c:url value="/page/news?category=国内"/>">国内</a></li>
            <li><a href="<c:url value="/page/news?category=国际"/>">国际</a></li>
            <li><a href="<c:url value="/page/news?category=财经"/>">财经</a></li>
            <li><a href="<c:url value="/page/news?category=科技"/>">科技</a></li>
            <li><a href="<c:url value="/page/news?category=体育"/>">体育</a></li>
            <li><a href="<c:url value="/page/news?category=娱乐"/>">娱乐</a></li>
            <li><a href="<c:url value="/page/news?category=生活"/>">生活</a></li>
            <li><a href="<c:url value="/page/news?category=观点"/>">观点</a></li>
        </ul>
    </nav>
</header>

<!-- 主要内容区 -->
<div class="container">
    <div class="main-content">
        <!-- 头条新闻 -->
        <section class="headline-news">
            <div class="main-headline">
                <img src="<c:url value="/resources/img/1.jpg"/>" alt="中国成功发射新一代载人飞船">
                <div class="headline-content">
                    <h2>中国成功发射新一代载人飞船试验船</h2>
                    <p>北京时间今日上午，我国在酒泉卫星发射中心成功发射新一代载人飞船试验船...</p>
                    <span class="news-time">10分钟前</span>
                </div>
            </div>


            <div class="sub-headlines">
                <c:forEach items="${homeNews}" var="news">
                    <div class="sub-headline">
                        <h3><a href="<c:url value="/page/get/news?id=${news.id}"/>">${news.title}</a></h3>
                        <span class="news-time">${news.air_time}</span>
                    </div>
                </c:forEach>
            </div>
        </section>

        <!--五个文字标题穿插一个图片标题 -->
        <section class="news-section">
            <h2 class="section-title">国内要闻</h2>
            <div class="mixed-news-list">
                <!-- 文字新闻1 -->
                <article class="text-news-item">
                    <h3>国庆假期全国接待游客8.26亿人次</h3>
                    <div class="text-news-meta">
                        <span class="source">央视新闻</span>
                        <span class="time">今天 14:30</span>
                    </div>
                </article>

                <!-- 文字新闻2 -->
                <article class="text-news-item">
                    <h3>京津冀协同发展新规划发布</h3>
                    <div class="text-news-meta">
                        <span class="source">新华网</span>
                        <span class="time">今天 11:15</span>
                    </div>
                </article>

                <!-- 文字新闻3 -->
                <article class="text-news-item">
                    <h3>我国新能源装机容量突破12亿千瓦</h3>
                    <div class="text-news-meta">
                        <span class="source">人民日报</span>
                        <span class="time">今天 09:45</span>
                    </div>
                </article>

                <!-- 文字新闻4 -->
                <article class="text-news-item">
                    <h3>全国铁路迎来返程客流高峰</h3>
                    <div class="text-news-meta">
                        <span class="source">中国新闻网</span>
                        <span class="time">今天 08:30</span>
                    </div>
                </article>

                <!-- 文字新闻5 -->
                <article class="text-news-item">
                    <h3>全国秋粮收获已过六成</h3>
                    <div class="text-news-meta">
                        <span class="source">农民日报</span>
                        <span class="time">今天 07:15</span>
                    </div>
                </article>

                <!-- 图片新闻1 -->
                <article class="image-news-item">
                    <img src="<c:url value="/resources/img/2.jpeg"/>" alt="国庆假期旅游">
                    <div class="image-news-info">
                        <h3>国庆假期全国接待游客8.26亿人次</h3>
                        <p>文化和旅游部数据显示，今年国庆假期全国国内旅游出游8.26亿人次...</p>
                        <div class="image-news-meta">
                            <span class="comments">1245评论</span>
                            <span class="time">今天 14:30</span>
                        </div>
                    </div>
                </article>

                <!-- 文字新闻6 -->
                <article class="text-news-item">
                    <h3>全国多地迎来降温天气</h3>
                    <div class="text-news-meta">
                        <span class="source">气象局</span>
                        <span class="time">今天 06:45</span>
                    </div>
                </article>

                <!-- 文字新闻7 -->
                <article class="text-news-item">
                    <h3>全国社保基金规模突破10万亿元</h3>
                    <div class="text-news-meta">
                        <span class="source">经济日报</span>
                        <span class="time">今天 05:30</span>
                    </div>
                </article>

                <!-- 文字新闻8 -->
                <article class="text-news-item">
                    <h3>全国义务教育阶段学校课后服务全覆盖</h3>
                    <div class="text-news-meta">
                        <span class="source">教育部</span>
                        <span class="time">今天 04:15</span>
                    </div>
                </article>

                <!-- 文字新闻9 -->
                <article class="text-news-item">
                    <h3>全国高速公路免费通行结束</h3>
                    <div class="text-news-meta">
                        <span class="source">交通部</span>
                        <span class="time">今天 03:00</span>
                    </div>
                </article>

                <!-- 文字新闻10 -->
                <article class="text-news-item">
                    <h3>全国快递业务量突破1000亿件</h3>
                    <div class="text-news-meta">
                        <span class="source">邮政局</span>
                        <span class="time">今天 02:45</span>
                    </div>
                </article>

                <!-- 图片新闻2 -->
                <article class="image-news-item">
                    <img src="<c:url value="/resources/img/6.jpeg"/>" alt="京津冀协同发展">
                    <div class="image-news-info">
                        <h3>京津冀协同发展新规划发布</h3>
                        <p>国家发展改革委印发《京津冀协同发展新阶段行动计划(2025-2030年)》...</p>
                        <div class="image-news-meta">
                            <span class="comments">876评论</span>
                            <span class="time">今天 11:15</span>
                        </div>
                    </div>
                </article>
            </div>
        </section>

        <!-- 国际动态 -->
        <section class="news-section">
            <h2 class="section-title">国际动态</h2>
            <div class="news-list">
                <article class="news-item">
                    <img src="<c:url value="/resources/img/5.jpeg"/>" alt="联合国气候决议">
                    <div class="news-info">
                        <h3>联合国通过全球气候行动新决议</h3>
                        <p>联合国大会以压倒性多数通过了一项关于加强全球气候行动的决议...</p>
                        <div class="news-meta">
                            <span class="source">路透社</span>
                            <span class="time">今天 09:45</span>
                            <span class="comments">563评论</span>
                        </div>
                    </div>
                </article>

                <article class="news-item">
                    <img src="<c:url value="/resources/img/7.jpg"/>" alt="全球经济论坛">
                    <div class="news-info">
                        <h3>2025全球经济论坛在瑞士达沃斯开幕</h3>
                        <p>第55届世界经济论坛年会在瑞士达沃斯开幕，全球政商领袖齐聚一堂...</p>
                        <div class="news-meta">
                            <span class="source">BBC</span>
                            <span class="time">昨天 22:30</span>
                            <span class="comments">421评论</span>
                        </div>
                    </div>
                </article>

                <article class="news-item">
                    <img src="<c:url value="/resources/img/8.jpg"/>" alt="诺贝尔奖">
                    <div class="news-info">
                        <h3>2025年诺贝尔物理学奖揭晓</h3>
                        <p>瑞典皇家科学院宣布将2025年诺贝尔物理学奖授予三位量子计算领域科学家...</p>
                        <div class="news-meta">
                            <span class="source">美联社</span>
                            <span class="time">昨天 18:15</span>
                            <span class="comments">789评论</span>
                        </div>
                    </div>
                </article>
            </div>
        </section>

        <!-- 分页控件 -->
        <div class="pagination">
            <a href="#">&laquo;</a>
            <a href="<c:url value="/page/get/news"/>" class="active">1</a>
            <a href="#">2</a>
            <a href="#">3</a>
            <a href="#">4</a>
            <a href="#">5</a>
            <a href="#">&raquo;</a>
        </div>
    </div>

    <!-- 侧边栏 -->
    <aside class="sidebar">
        <div class="sidebar-widget hot-topics">
            <h3>热点排行</h3>
            <ol>
                <li>中国成功发射新一代载人飞船</li>
                <li>国庆假期旅游数据创新高</li>
                <li>全球AI峰会达成重要共识</li>
                <li>京津冀协同发展新规划</li>
                <li>联合国通过气候行动决议</li>
                <li>新能源装机容量突破12亿千瓦</li>
                <li>诺贝尔物理学奖揭晓</li>
                <li>达沃斯经济论坛开幕</li>
                <li>亚运会中国女排首战告捷</li>
                <li>数字经济发展意见发布</li>
            </ol>
        </div>

        <div class="sidebar-widget live-broadcast">
            <h3>直播中</h3>
            <div class="live-item">
                <img src="<c:url value="/resources/img/3.jpeg"/>" alt="亚运会女排比赛">
                <p>亚运会中国女排对阵日本</p>
            </div>
            <div class="live-item">
                <img src="<c:url value="/resources/img/4.jpeg"/>" alt="全球AI峰会">
                <p>全球人工智能峰会闭幕式</p>
            </div>
        </div>
    </aside>
</div>

<!-- 底部区域 -->
<footer class="news-footer">
    <div class="footer-container">
        <div class="footer-links">
            <a href="#">关于我们</a>
            <a href="#">联系方式</a>
            <a href="#">广告服务</a>
            <a href="#">版权声明</a>
            <a href="#">隐私政策</a>
        </div>
        <div class="copyright">
            <p>© 2025 新华每日新闻 版权所有 ICP证：京ICP备12345678号</p>
        </div>
    </div>
</footer>
<script src="<c:url value="/resources/js/jquery-3.7.1.min.js"/>"></script>
<script>
    function logout() {
        $(document).ready(function () {
            $.ajax({
                url: '/logout',
                type: 'get',
                success: function (data) {
                    location.reload();
                },
                error: function (data) {
                    alert('出错了');
                }
            });
        });
    }
</script>
</body>
</html>
